<?php

namespace admin\controllers;

use admin\assets\AppAsset;
use admin\models\Menus;
use ijony\helpers\Url;
use Yii;

/**
 * 控制器基类
 *
 * @inheritdoc
 */
class BaseController extends \ijony\admin\controllers\Controller
{

    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();

        if(YII_ENV_DEV){
            $this->topButtons[] = [
                'name' => '菜单',
                'url' => Url::to(['/menu']),
                'icon' => 'list',
            ];
        }

        AppAsset::register($this->view);
    }

    /**
     * @inheritdoc
     */
    public function getMenus()
    {
        return Menus::getMenus();
    }
}
